package com.ye.media.util;

//一些时间的转换
public class TimeConvert {

	//ms转换为hh:mm:ss
	public static String formatTime(long ms) {  
	    int ss = 1000;  
	    int mi = ss * 60;  
	    int hh = mi * 60;  
	    int dd = hh * 24;  
	  
	    long day = ms / dd;  
	    long hour = (ms - day * dd) / hh;  
	    long minute = (ms - day * dd - hour * hh) / mi;  
	    long second = (ms - day * dd - hour * hh - minute * mi) / ss; 
	      
	    StringBuffer sb = new StringBuffer();  
	    if(hour > 0) {  
	        sb.append(hour+":");  
	    }
	    if(minute >= 0) {  
	        sb.append(String.format("%02d", minute)+":");  
	    }
	    if(second >= 0){
	        sb.append(String.format("%02d", second));  
	    }
	    return sb.toString();  
	} 
}
